package org.aplombh.java.interview.newcoder;

import java.util.Scanner;

// HJ2 计算某字符出现次数
public class HJ2_计算某字符出现次数 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine().toUpperCase();
        String c = in.next().toUpperCase();
        System.out.println(str.replaceAll("[^" + c + "]", ""));
        System.out.println(str.replaceAll("[^" + c + "]", "").length());
        //   [^(字符串)] 匹配字符串以外其它字符串
        in.close();
    }
}